package com.pulaien.shop.controller;

import com.pulaien.common.annotation.Log;
import com.pulaien.common.core.controller.BaseController;
import com.pulaien.common.core.domain.AjaxResult;
import com.pulaien.common.core.page.TableDataInfo;
import com.pulaien.common.enums.BusinessType;
import com.pulaien.common.utils.poi.ExcelUtil;
import com.pulaien.system.domain.ConfigLogisticsCompany;
import com.pulaien.system.service.IConfigLogisticsCompanyService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import javax.servlet.http.HttpServletResponse;
import java.util.List;

/**
 * 物流公司配置Controller
 *
 * @author pulaien
 */
@RestController
@RequestMapping("/shop/logisticsCompany")
@Api(tags = "商城端物流公司配置")
public class ShopLogisticsCompanyController extends BaseController {
    @Autowired
    private IConfigLogisticsCompanyService configLogisticsCompanyService;

    @ApiOperation("获取下拉列表")
    @RequestMapping(value = "/getDropDownList", method = RequestMethod.GET)
    @ResponseBody
    public AjaxResult getDropDownList() {
        return AjaxResult.success(configLogisticsCompanyService.getDropDownList());
    }

    @ApiOperation("获取装箱单物流下拉列表")
    @RequestMapping(value = "/getDropDownForLineList/{line}", method = RequestMethod.GET)
    @ResponseBody
    public AjaxResult getDropDownForLineList(@PathVariable String line) {
        return AjaxResult.success(configLogisticsCompanyService.getDropDownForLineList(line));
    }

    /**
     * 查询物流公司配置列表
     */
    @ApiOperation(value = "物流公司配置列表分页")
    @GetMapping("/list")
    public TableDataInfo list(ConfigLogisticsCompany configLogisticsCompany) {
        startPage();
        List<ConfigLogisticsCompany> list = configLogisticsCompanyService.selectConfigLogisticsCompanyList(configLogisticsCompany);
        return getDataTable(list);
    }

    /**
     * 获取物流公司配置详情
     */
    @ApiOperation(value = "获取物流公司配置详情")
    @GetMapping(value = "/{id}")
    public AjaxResult getInfo(@PathVariable("id") Long id) {
        return success(configLogisticsCompanyService.selectConfigLogisticsCompanyById(id));
    }


}
